<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s"  uri="/struts-tags"%>
<%@ include file="../common.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>商品列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">   
<style type="text/css">
td{
text-align: center;

}
img{
	width: 100px;
	height: 100px;
}

</style>
<script type="text/javascript">
	function deleteGoods(id){
		var path=window.document.location.href; 
		path=path.substring(0,path.indexOf("SSI")+3)+"/";
		var tr=confirm("确认要删除？");
		if(!tr){
			return false;
			}else{
				return	path+"goods/goods_delete.do?id="+id;
			}
		}

</script>
  </head>
  
  <body>
  <s:debug></s:debug>
    <center>
    	<h2>商品列表</h2>
    	<s:if test="%{#session.user.username!='visitor'}">
    	<h3><s:a action="goods_addUI.do" namespace="/goods">添加新商品</s:a> </h3>
    	</s:if>
        <table width="90%" border="1">
            <tr>
            	
            	<th>商品图片</th>
            	<th>商品名称</th>
            	<th>商品添加者</th>
            	<th>商品添加时间</th>
            	<th>商品类型</th>
            	<th>浏览次数</th>
            	<th>备注</th>
            	<s:if test="%{#session.user!=null}">
            	<th>操作</th>
            	</s:if>  
            </tr>
	        <s:iterator  value="goodsList">
	        	<tr>
	        	
	        		<td><a href="<s:property value='goodsUrl'/>"  target="_blank"><img src="<s:property value='goodsImgUrl'/>"></a></td>
	        		<td  style="width:30%;"><a href="<s:property value='goodsUrl'/>"  target="_blank"><s:property value="goodsName"/></a></td>
	        		<td style="width:10%;"><s:property value="createAuthor"/> </td>
	        		<td style="width:10%;"><s:property value="createDate"/> </td>
	        		<td style="width:10%;"><s:property value="goodsTypeId"/> </td> 
	        		<td style="width:10%;"><s:property value="goodsViewsCount"/> </td> 
	        		<td style="width:10%;"><s:property value="other"/> </td>
	        		
	        		<s:if test="%{#session.user!=null}">
   				<td style="width:20%;"> <s:a action="goods_updateUI.do" namespace="/goods"><s:param name="goods.id">${id}</s:param>修改</s:a>
	        		&nbsp;&nbsp;
	        		<s:a action="goods_delete.do" namespace="/goods" onclick="deleteGoods"><s:param name="goods.id">${id}</s:param>删除</s:a></td>
   					</s:if>  	        	
	        	</tr>
	        </s:iterator>
        </table>
    </center>
  </body>
</html>
